{{Extend "layout"}}
{{Block "title"}}{{$.Stored.title}}{{/Block}}
{{Block "breadcrumb"}}
{{Super}}
<li class="active">{{$.Stored.title}}</li>
{{/Block}}

{{Block "bodyNav"}}
{{Include "manager/alert_recipient_body_nav"}}
{{/Block}}

{{Block "main"}}
<div class="row">
				<div class="col-md-12">
					<div class="block-flat no-padding">
						<div class="header">
							<a href="{{BackendURL}}/manager/alert_recipient_add" class="btn btn-success pull-right">
								<i class="fa fa-plus"></i>
								{{"添加告警通知账号"|$.T}}
							</a>
							<h3>{{"告警通知账号"|$.T}}</h3>
						</div>
						<div class="content">
							<div class="table-responsive">
							<table class="table no-border hover">
								<thead class="no-border">
									<tr>
										<th style="width:60px"><strong>ID</strong></th>
										<th><strong>{{"名称"|$.T}}</strong></th>
										<th><strong>{{"账号"|$.T}}</strong></th>
										<th style="width:60px"><strong>{{"类型"|$.T}}</strong></th>
										<th style="width:100px"><strong>{{"平台"|$.T}}</strong></th>
										<th style="width:160px"><strong>{{"时间"|$.T}}</strong></th>
										<th style="width:60px"><strong>{{"状态"|$.T}}</strong></th>
										<th style="width:80px" class="text-center"><strong>{{"操作"|$.T}}</strong></th>
									</tr>
								</thead>
								<tbody class="no-border-y">
                                    {{range $k,$v := $.Stored.listData}}
									<tr>
										<td>{{$v.Id}}</td>
										<td>{{$v.Name}}</td>
										<td>{{$v.Account}}</td>
										<td>{{$v.Type}}</td>
										<td>{{call $.Func.platformName $v.Platform}}</td>
										<td>
											{{`创建`|$.T}}:{{$v.Created|DateFormat "2006-01-02 15:04:05"}}<br />
											{{`更新`|$.T}}:{{- if gt $v.Updated 0 -}}
											{{$v.Updated|DateFormat "2006-01-02 15:04:05"}}
											{{- else -}}
											-
											{{- end -}}
										</td>
										<td>
											<div class="checkbox checkbox-success no-margin-y">
												<input id="checkbox-{{$k}}" class="styled switch-disabled" type="checkbox" data-id="{{$v.Id}}"{{if eq $v.Disabled `N`}} checked="checked"{{end}} value="N" /><label for="checkbox-{{$k}}">{{"启用"|$.T}}</label>
											</div>
										</td>
										<td class="label-group">
										<a class="label label-default" data-toggle="tooltip" title="{{`复制`|$.T}}" href="{{BackendURL}}/manager/alert_recipient_add?copyId={{$v.Id}}"><i class="fa fa-copy"></i></a>
										<a class="label label-warning" href="javascript:;" data-toggle="tooltip" title="{{`测试`|$.T}}" onclick="sendTestAlert(this)" data-test-url="{{BackendURL}}/manager/alert_recipient_test?id={{$v.Id}}"><i class="fa fa-refresh"></i></a> 
										<a class="label label-success" href="{{BackendURL}}/manager/alert_recipient_edit?id={{$v.Id}}" data-toggle="tooltip" title="{{`修改`|$.T}}"><i class="fa fa-pencil"></i></a> 
										<a class="label label-danger" href="{{BackendURL}}/manager/alert_recipient_delete?id={{$v.Id}}" onclick="return confirm('{{`真的要删除吗？`|$.T}}');" data-toggle="tooltip" title="{{`删除`|$.T}}"><i class="fa fa-times"></i></a>
										</td>
									</tr>
                                    {{end}}
								</tbody>
							</table>		
							</div>
							{{$.Stored.pagination.Render}}
						</div>
					</div>				
				</div>
			</div>
{{/Block}}
{{Block "footer"}}
<script>
function sendTestAlert(a){
	var url = $(a).data('test-url');
	$.post(url, {}, function(r){
		App.message({text: r.Info, type: (r.Code == 1 ? 'success' : 'error')})
	}, 'json');
}
$(function(){
	App.bindSwitch('input.switch-disabled','click','manager/alert_recipient_edit');
});
</script>
{{/Block}}